const { defineConfig } = require("@vue/cli-service");
const path = require("path");
module.exports = defineConfig({
  publicPath: "./",
  transpileDependencies: true,
  devServer: {
    port: 1234,
    proxy: {
      "^/fcj": {
        target: "http://www.lrfc.vip:1798",
        changeOrigin: true,
      },
      // "^/hehe": {
      //   target: "http://www.lrfc.vip:1798",
      //   changeOrigin: true,
      //   pathRewrite: {
      //     "^/hehe": "", // 将多余的路径替换掉
      //   },
      // },
    },
  },
  chainWebpack: (config) => {
    // alias 别名 写路径减少相对路径的出现
    config.resolve.alias
      .set("@", path.resolve(__dirname, "./src"))
      .set("@views", path.resolve(__dirname, "./src/views"))
      .set("@styles", path.resolve(__dirname, "./src/styles"))
      .set("@utils", path.resolve(__dirname, "./src/utils"))
      .set("@axios", path.resolve(__dirname, "./src/components/axios"));
  },
});

// 目标url "http://www.lrfc.vip:1798/fcj/music/rankSongList"
// 代码请求 http://localhost:2333/hehe/fcj/music/rankSongList
// 代理转发 http://www.lrfc.vip:1798/hehe/fcj/music/rankSongList
